﻿<UserControl x:Class="Mnk.TBox.Plugins.NUnitRunner.Components.TestsView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:loc="clr-namespace:Mnk.TBox.Plugins.NUnitRunner.Code.Localization"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:components="clr-namespace:Mnk.TBox.Plugins.NUnitRunner.Components"
             xmlns:local="clr-namespace:Mnk.Library.WpfControls.Components.CheckableTreeView;assembly=Mnk.Library.WPFControls"
             xmlns:gif="http://wpfanimatedgif.codeplex.com"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>
        <components:ResultStateToIconConverter x:Key="IconConverter"/>
        <components:TestResultToVisibilityRevertedConverter x:Key="TestResultToVisibilityRevertedConverter"/>
        <components:TestResultToVisibilityConverter x:Key="TestResultToVisibilityConverter"/>
    </UserControl.Resources>
    <DockPanel>
        <StatusBar DockPanel.Dock="Bottom" HorizontalAlignment="Right">
            <StatusBarItem Content="{loc:Tr Total}" />
            <StatusBarItem Name="Total" />
            <StatusBarItem Content="{loc:Tr Passed}" />
            <StatusBarItem Name="Passed" />
            <StatusBarItem Content="{loc:Tr Failed}" />
            <StatusBarItem Name="Failed" />
            <StatusBarItem Content="{loc:Tr Errors}" />
            <StatusBarItem Name="Errors" />
            <StatusBarItem Content="{loc:Tr Inconclusive}" />
            <StatusBarItem Name="Inconclusive" />
            <StatusBarItem Content="{loc:Tr Invalid}" />
            <StatusBarItem Name="Invalid" />
            <StatusBarItem Content="{loc:Tr Ignored}" />
            <StatusBarItem Name="Ignored" />
            <StatusBarItem Content="{loc:Tr Skipped}" />
            <StatusBarItem Name="Skipped" />
            <StatusBarItem Content="{loc:Tr Time}" />
            <StatusBarItem Name="Time" />
        </StatusBar>
        <Grid Name="Panel">
            <Grid.ColumnDefinitions>
                <ColumnDefinition MinWidth="128" />
                <ColumnDefinition Width="5"/>
                <ColumnDefinition MinWidth="128"/>
            </Grid.ColumnDefinitions>
            <local:CheckableTreeView Name="results" SelectedItemChanged="SelectedTestChanged">
                <local:CheckableTreeView.TreeViewResources>
                    <HierarchicalDataTemplate DataType="{x:Type local:Node}" ItemsSource="{Binding Children}">
                        <StackPanel Orientation="Horizontal" >
                            <CheckBox Focusable="False" IsChecked="{Binding IsChecked}" Uid="{Binding Id}" PreviewMouseLeftButtonDown="OnMouseLeftButtonDown" Margin="1"/>
                            <Image Source="{Binding Data.State, Converter={StaticResource IconConverter}}" DockPanel.Dock="Left" Width="16" Height="16" Visibility="{Binding Data, Converter={StaticResource TestResultToVisibilityRevertedConverter}}"/>
                            <Image gif:ImageBehavior.AnimatedSource="/Mnk.TBox.Plugins.NUnitRunner;component/Resources/spinner.gif" DockPanel.Dock="Left" Width="16" Height="16"  Visibility="{Binding Data, Converter={StaticResource TestResultToVisibilityConverter}}"/>
                            <TextBlock Text="{Binding Data.Key}" Margin="1" TextTrimming="CharacterEllipsis" TextWrapping="Wrap"/>
                        </StackPanel>
                    </HierarchicalDataTemplate>
                    <Style TargetType="TreeViewItem">
                        <Setter Property="IsExpanded" Value="{Binding Path=IsExpanded, Mode=TwoWay}" />
                    </Style>
                </local:CheckableTreeView.TreeViewResources>
            </local:CheckableTreeView>
            <GridSplitter Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" ResizeDirection="Columns"/>
            <GroupBox Header="{loc:Tr Summary}" Grid.Column="2" >
                <DockPanel>
                    <TextBlock Name="TestTime" Text="{loc:Tr TestTime}" VerticalAlignment="Center" DockPanel.Dock="Top" Margin="5"/>
                    <TextBox Name="Description" IsReadOnly="True" Margin="5" TextWrapping="Wrap" IsReadOnlyCaretVisible="True" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" />
                </DockPanel>
            </GroupBox>
        </Grid>
    </DockPanel>
</UserControl>
